#include <iostream>

using namespace std;

double divide(double a, double b)
{
    const double delta = 0.000000000000001;
    double ret = 0;

    if( !((-delta < b) && (b < delta)) ) {
        ret = a / b;
    }
    else {
        throw 0;    //产生除 0 异常
    }

    return ret;
}
int main()
{
    cout << "main() begin" << endl;
    try
    {
        double c = divide(1, 0);

        cout << "c = " << c << endl;
    }
    catch(...)
    {
        cout << "Divided by zero..." << endl;
    }
    cout << "main() end" << endl;
    return 0;
}
